Group Items - Divide objects to groups by a selected key

This action receives a sorted list of items, and groups them by a selected element (key).

It returns a list of groups, each containing the group's key value and a list of items that share this key.

The process is provided as a template, so you can modify it to fit your application's needs. However, it is is meant to be reusable: the items received are of type "Anything", and the key can also be of an arbitrary data type. In a typical application you will instantiate one copy of this process and use it wherever you need to group items.

Triggers

<Items> (repetitive trigger [required]): The list of objects (of any type). The items may have different types (as long as each of them contains a <Key Element Name> element, and all these elements have matching data types).

<Key Element Name> (non-repetitive trigger [required]): The name of the element by which grouping is made (for composite structures, "deep comparison" is used to determine object equality, and for numbers some tolerance is allowed, so two different key elements may be considered equal; for details refer to Equal).

Exits

<Groups> (repetitive exit [required]): A list of the created groups, each containing the group's key value (Key) and a list of items that share this key (Items).

Usage Example

http://www.tersus.com/#Id=664: